<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

function mailto($to,$title,$content){
	$mail = new PHPMailer(true);                              // Passing `true` enables exceptions
try {
    //Server settings
    $mail->SMTPDebug = 0;
    $mail->CharSet='utf-8';                                 // Enable verbose debug output
    $mail->isSMTP();                                      // Set mailer to use SMTP
    $mail->Host = 'smtp.163.com';  // Specify main and backup SMTP servers
    $mail->SMTPAuth = true;                               // Enable SMTP authentication
    $mail->Username = 'mengtaoliusix6@163.com';                 // SMTP username
    $mail->Password = 'wangyi163';                           // SMTP password
    $mail->SMTPSecure = 'ssl';                            // Enable TLS encryption, `ssl` also accepted
    $mail->Port = 465;                                    // TCP port to connect to

    //Recipients
    $mail->setFrom('mengtaoliusix6@163.com', '刘德华');
    $mail->addAddress($to);     // Add a recipient
    //Content
    $mail->isHTML(true);                                  // Set email format to HTML
    $mail->Subject = $title;
    $mail->Body    = $content;


    return $mail->send();
    
} catch (Exception $e) {
    exception($mail->ErrorInfo,1001);
}
}
//span替换为a链接
function replace($data){
    return str_replace('span','a',$data);
}
//字符串改数组
function strToArray($data){
    return explode('|',$data);
}


